﻿using System;
using System.Collections;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using Rison.DataAccess.Data.ZJCP;

namespace Rison.Web.ZJCP.ashx
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class load_depart_by_id : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string departmentId = context.Request.Params["departmentId"];
            if (!String.IsNullOrEmpty(departmentId))
            {
                context.Response.Write(loadDepartById(departmentId));
            }
            else
            {
                context.Response.Write("未找到部门！");
            }

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
        private string loadDepartById(string departmentId)
        {
            string sql = String.Format("select DepartName from Department where DepartId='{0}'", departmentId);
            DataSet ds = DbAccess.executeQuery(sql);
            return ds.Tables[0].Rows[0][0].ToString();
        }
    }
}
